package com.mingqijia.gassafety.shared.constant.runningReport;

public enum ReportContentTypeEnum {

    OFFLINE(3, "有离线"),
    ALARM(0, "有报警"),
    NO_ALARM(1, "正常运行"),
    BROKEN(2, "有故障");

    ReportContentTypeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private static final ReportContentTypeEnum[] VALUES = ReportContentTypeEnum.values();

    public static ReportContentTypeEnum matcher(int value) {
        for (ReportContentTypeEnum ele : VALUES) {
            if (ele.code == value) {
                return ele;
            }
        }
        return null;
    }

    public static String getNameByCode(Integer code) {
        String nameValue = "";
        for (ReportContentTypeEnum mode : ReportContentTypeEnum.values()) {
            if (mode.getCode().equals(code)) {
                nameValue = mode.getMsg();
                break;
            }
        }
        return nameValue;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    private Integer code;
    private String msg;
}
